package io.renren;

import io.renren.common.utils.PageUtils;

import java.util.List;
import java.util.Map;

public class PageUtil {

    public static PageUtils getPageUtils(List<?> list,Integer total,Map<String, Object> params) {

        return new PageUtils(list,total,(Integer) params.get("page"),(Integer) params.get("limit"));
    }

    public static void formatPageParams(Map<String, Object> params) {

        Integer page = Integer.parseInt((String) params.get("page"));
        Integer limit = Integer.parseInt((String) params.get("limit"));
        ;
        params.put("start", (page - 1) * limit);
        params.put("page", page);
        params.put("limit", limit);
    }
}
